Fix synced mobile books opening with stale file paths#447
Open
codedogQBY wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Analysis
Issue #314 reports Android books failing to open, and the diagnostic log repeatedly shows the reader WebView failing with
Error: File not foundimmediately after sync/download activity.The sync database payload can bring a
books.file_pathandsync_statusfrom another device. If that source device stored the file as local, the receiving device could also mark the book aslocaleven when the file has not been downloaded to this device yet. For source-device absolute orfile://paths, the mobile reader then asks its local HTTP server for a path that does not exist under the current app data directory.Changes
books/{bookId}.{ext}when applying remote book records.remoteuntil the current device confirms or downloads the file locally.filePathandsyncStatustogether after a successful on-demand download.localduring file sync.Verification
pnpm --filter @readany/core test -- sync-files simple-sync.integrationpnpm --filter @readany/core exec tsc --noEmitpnpm exec biome check packages/core/src/sync/local-book-paths.ts packages/core/src/sync/simple-sync.ts packages/core/src/sync/sync-files.ts packages/core/src/sync/__tests__/simple-sync.integration.test.ts packages/core/src/sync/__tests__/sync-files.test.tsgit diff --checkFixes #314